<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j"
	  xmlns:easy="http://easyfaces.com.br/easyfaces">
	
	<f:subview id="subviewManterContaPagar">
					<script type="text/javascript">		
					

					function preencheDadosPopupFormaPagamento(codigo, descricao) {
						document.getElementById('subviewManterContaPagar:formContaPagarManter:contaPagar_formaPagamento_codigo').value = codigo;
						document.getElementById('subviewManterContaPagar:formContaPagarManter:contaPagar_formaPagamento_descricao').value = descricao;
					}
					
				</script>
		<rich:modalPanel id="manterContaPagar" autosized="true" headerClass="height:20px;" resizeable="false" >
			<f:facet name="header">
				<h:outputText value="#{bundle.conta_pagar_titulo_manter}" />
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:graphicImage value="/images/close.gif" styleClass="botao_fechar_popup" id="hideLink">
						<rich:componentControl for="manterContaPagar" attachTo="hideLink" operation="hide" event="onclick" />
					</h:graphicImage>
				</h:panelGroup>
			</f:facet>
			<b><font color="red"><rich:messages id="msgContaPagarManter"></rich:messages></font></b>
			<a4j:form ajaxSubmit="true" id="formContaPagarManter" reRender="formContaPagarManter">
			
				<script type="text/javascript">		
					function valida() {
						if (#{facesContext.maximumSeverity == null}) {
							#{rich:component('manterContaPagar')}.hide();
						}
					}
				</script>
			
                <h:panelGrid columns="2" width="600px">                    
                	<h:outputLabel value="#{bundle.conta_pagar_descricao}" style="color:red;" for="conta_pagar_descricao" />
                    <h:inputText id="conta_pagar_descricao" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.descricao}" label="#{bundle.conta_pagar_descricao}" maxlength="80" size="40" disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}" />
             
					 <!--  Forma de Pagamento -->
	                
                	<h:outputLabel value="#{bundle.condicao_pagamento_forma_pagamento}:" style="color:red;"  for="contaPagar_formaPagamento_descricao" />
                	<h:panelGroup>
                	<h:inputText id="contaPagar_formaPagamento_descricao" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.formaPagamentoVO.descricao}" label="#{bundle.contaPagar_formaPagamento_descricao}" size="40" maxlength="50" />
                    <a4j:commandButton value="#{bundle.condicao_pagamento_btn_popup}" id="btnPopupFormaPagamento" reRender="formCondicaoPagamentoManter" disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}">
                    	<rich:componentControl for="popupFormaPagamento" attachTo="btnPopupFormaPagamento" operation="show" event="onclick" />
                    </a4j:commandButton>
	                </h:panelGroup>
	                                    	
                	<h:inputHidden id="contaPagar_formaPagamento_codigo" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.formaPagamentoVO.codigo}" label="#{bundle.contaPagar_formaPagamento_codigo}" />
                	<rich:jQuery selector="contaPagar_formaPagamento_descricao" timing="onload" query="attr('readOnly', true)" />
                	
                	<!-- Fim Forma de Pagamento -->                     
                    
					<h:outputLabel value="Fornecedor:" />
                    <h:inputText id="conta_pagar_fornecedor" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.compraVO.fornecedorVO.nome}" maxlength="70" size="40" readonly="true"   disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}"/>

                    <h:outputLabel value="#{bundle.conta_pagar_valor}" for="conta_pagar_valor" style="color:red;"/>
                    <easy:inputCurrency id="conta_pagar_valor" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.valor}" label="#{bundle.conta_pagar_parcela_valor}" decimalSeparator="," groupSeparator="." maxlength="14" size="15" disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}"/>

					<h:outputLabel value="#{bundle.conta_pagar_data_emissao}:" style="color:red;" />
                    <rich:calendar id="conta_pagar_emissao" datePattern="dd/MM/yyyy" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.dataEmissao}" maxlength="10" inputStyle="width:8em"  disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}"/>
					
					<h:outputLabel value="#{bundle.conta_pagar_data_vencimento}:" style="color:red;" />
					<rich:calendar id="conta_pagar_vencimento" datePattern="dd/MM/yyyy" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.dataVencimento}" maxlength="10"  inputStyle="width:8em" disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}"/>
                    
					<h:outputLabel value="#{bundle.conta_pagar_data_pagamento}:" style="color:red;" />
                    <rich:calendar id="conta_pagar_pago"  datePattern="dd/MM/yyyy" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.dataPago}" maxlength="10"  inputStyle="width:8em" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}"  >
                    	<a4j:support action="#{contaPagarBackBean.acCalculaJurosMultaDesconto}" event="onchanged" reRender="vlPago,contaMulta,contaJuros,contaDesconto" />
                    </rich:calendar>
                                        

					<h:outputLabel value="#{bundle.conta_pagar_data_cancelamento}:" style="color:red;" />
					<rich:calendar id="conta_pagar_cancelamento"  datePattern="dd/MM/yyyy" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.dataCancelamento}" maxlength="10"  inputStyle="width:8em" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}"/>



                    <h:outputLabel  value="Multa:" style="color:red;"  />
                    <h:inputText id="contaMulta" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.multa}" maxlength="4"   size="15"  style="text-align:right;"  onkeypress="javascript:somenteDigitos(event,'decOK');" onkeyup="validarValorMaximo(this, 100);" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}">
                    	<a4j:support action="#{contaPagarBackBean.acCalculaJurosMultaDesconto}" event="onblur" reRender="vlPago,contaMulta,contaJuros,contaDesconto" />
                    </h:inputText>
                    
                    <h:outputLabel  value="Juros/Dia:" style="color:red;"  />
                    <h:inputText id="contaJuros"  value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.juros}" maxlength="4"   size="15"  style="text-align:right;"  onkeypress="javascript:somenteDigitos(event,'decOK');" onkeyup="validarValorMaximo(this, 100);" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}" >
						<a4j:support action="#{contaPagarBackBean.acCalculaJurosMultaDesconto}" event="onblur" reRender="vlPago,contaMulta,contaJuros,contaDesconto" />
                    </h:inputText>

                    <h:outputLabel  value="Desconto:" style="color:red;"  />
                    <h:inputText id="contaDesconto" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.desconto}" maxlength="9"   size="15"  style="text-align:right;" onkeypress="javascript:somenteDigitos(event,'decOK');" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}"   >
                   		<a4j:support action="#{contaPagarBackBean.acCalculaJurosMultaDesconto}" event="onblur" reRender="vlPago,contaMulta,contaJuros,contaDesconto" />
                    </h:inputText>
					
                    <h:outputLabel value="Valor a ser Pago" />
                    <h:inputText id="vlPago" value="#{contaPagarBackBean.contaPagarFormBean.contaPagarManter.valorPago}" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada}" maxlength="14" size="15" style="text-align:right;" readonly="true"/>
                   
                </h:panelGrid>
                
                <div class="linha"/>
                
                <a4j:commandButton action="#{contaPagarBackBean.manterContaPagar}" value="#{bundle.conta_pagar_btn_gravar}" id="btnGravar" reRender="formContaPagarConsulta, formContaPagarManter" oncomplete="valida();" disabled="#{contaPagarBackBean.contaPagarFormBean.isDisabled}" />
                <a4j:commandButton action="#{contaPagarBackBean.pagarContaPagar}" value="#{bundle.conta_pagar_pagar}" id="btnPagar" reRender="formContaPagarConsulta,formContaPagarManter"  oncomplete="javascript:valida();" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}"  rendered="#{contaPagarBackBean.contaPagarFormBean.isFinalizada == false}"  />
                <a4j:commandButton action="#{contaPagarBackBean.cancelarContaPagar}" value="#{bundle.conta_pagar_btn_cancelar}" id="btnCancelar" reRender="formContaPagarConsulta,formContaPagarManter"  oncomplete="javascript:valida();" disabled="#{contaPagarBackBean.contaPagarFormBean.isFinalizada || contaPagarBackBean.contaPagarFormBean.contaPagarManter.codigo == 0}"  rendered="#{contaPagarBackBean.contaPagarFormBean.isFinalizada == false}"   />
                <a4j:commandButton value="#{bundle.conta_pagar_btn_voltar}" id="btnVoltar" reRender="formContaPagarConsulta, formContaPagarManter" oncomplete="valida();" />
			</a4j:form>

		 <div class="linha"/>
			<h:outputLabel value="#{bundle.campos_obrigatorios}" style="color:red;"/> 
		</rich:modalPanel>
		
		<ui:include src="/pages/formaPagamento/popupFormaPagamento.xhtml" />
	
	</f:subview>

</html>